#include "peripherial_init.h"
#include "osram96x16x1.h"

extern unsigned char rewriteColumns[6];
extern unsigned char drawTbl[192];

void draw(void){

	short i;
	unsigned char X,Y;
	//
    // Move the display cursor to the requested position on the display.
    //
	for(i=0; i<6; i++){
		X = rewriteColumns[i]%96 + 36;
		Y = rewriteColumns[i]/96;

		OSRAM96x16x1WriteFirst(0x80);
        OSRAM96x16x1WriteByte(( Y == 0) ? 0xb0 : 0xb1);
        OSRAM96x16x1WriteByte(0x80);
        OSRAM96x16x1WriteByte( X & 0x0f );
        OSRAM96x16x1WriteByte(0x80);
        OSRAM96x16x1WriteByte(0x10 | (( X >> 4) & 0x0f));
        OSRAM96x16x1WriteByte(0x40);
		//write final column

		OSRAM96x16x1WriteFinal(drawTbl[rewriteColumns[i]]);		
		

	}
}
